package com.bling.common.page;


import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
 * 分页模型
 * @author BLingSoft
 *
 */
public class PageResult<T> implements Serializable {

	private static final long serialVersionUID = 373524566473682652L;

	private int pagecurrent; //当前页码
	private int pagesum;//总页数
	private int pagesize;//每页显示条数
	private int itemsum;//记录总条数
	private List<T> result = new ArrayList<T>();//记录集合
	/**
	 * 每页默认显示15页
	 * @return
	 */
	public static int getDefaultPageSize(){
		return 15;
	}
	
	public PageResult() {
		super();
	}
	public PageResult(int itemsum, List<T> result) {
		super();
		this.itemsum = itemsum;
		this.result = result;
	}
	public int getPagecurrent() {
		return pagecurrent;
	}
	public void setPagecurrent(int pagecurrent) {
		this.pagecurrent = pagecurrent;
	}
	public int getPagesum() {
		if((itemsum%pagesize)==0)
			pagesum=itemsum/pagesize;
		else
			pagesum=itemsum/pagesize+1;
		return pagesum;
	}
	public void setPagesum(int pagesum) {
		this.pagesum = pagesum;
	}
	public int getPagesize() {
		return pagesize;
	}
	public void setPagesize(int pagesize) {
		this.pagesize = pagesize;
	}
	public int getItemsum() {
		return itemsum;
	}
	public void setItemsum(int itemsum) {
		this.itemsum = itemsum;
	}
	public List<T> getResult() {
		return result;
	}
	public void setResult(List<T> result) {
		this.result = result;
	}
}
